package social_network.entities;

import static org.junit.Assert.*;

import org.junit.Before;
import org.junit.Test;

/**
 * @author Maksym Zabrodskyi
 */
public class AdministratorTest {

	Administrator admin;

	@Before
	public void setUp() throws Exception {
		Integer id = 45;
		String email = "admin@gmail.com";
		String name = "Admin";
		String surname = "Administrator";
		String password = "1q2W3e4R";
		admin = new Administrator(id, email, name, surname, password);
	}

	@Test
	public void testGetId() {
		Integer expectedId = 45;
		Integer actualId = admin.getId();
		assertEquals(expectedId, actualId);
	}

	@Test
	public void testGetEmail() {
		String expectedEmail = "admin@gmail.com";
		String actualEmail = admin.getEmail();
		assertEquals(expectedEmail, actualEmail);
	}

	@Test
	public void testGetName() {
		String expectedName = "Admin";
		String actualName = admin.getName();
		assertEquals(expectedName, actualName);
	}

	@Test
	public void testGetSurname() {
		String expectedSurname = "Administrator";
		String actualSurname = admin.getSurname();
		assertEquals(expectedSurname, actualSurname);
	}

	@Test
	public void testGetPassword() {
		String expectedPassword = "1q2W3e4R";
		String actualPassword = admin.getPassword();
		assertEquals(expectedPassword, actualPassword);
	}

	@Test
	public void testHashCode() {
		int expectedHash = 45;
		int actualHash = admin.hashCode();
		assertEquals(expectedHash, actualHash);
	}

	@Test
	public void testEqualsObject() {
		Integer id = 45;
		String email = "admin@gmail.com";
		String name = "Admin";
		String surname = "Administrator";
		String password = "1q2W3e4R";
		Administrator otherAdmin = new Administrator(id, email, name, surname,
				password);
		assertTrue(admin.equals(otherAdmin));
	}

	@Test
	public void testToString() {
		String expectedAdminToString = "entities.Administrator [ id = 45 ]";
		String actualAdminToString = admin.toString();
		assertEquals(expectedAdminToString, actualAdminToString);
	}

}
